package com.mitdy.sg.data.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.mitdy.sg.common.bean.Pagination;
import com.mitdy.sg.data.mapper.BasketballGameQuarterScoreMapper;
import com.mitdy.sg.data.vo.BasketballGameQuarterScoreVO;

@Service
public class BasketballGameQuarterScoreService {

	@Autowired
	private BasketballGameQuarterScoreMapper basketballGameQuarterScoreMapper;

	public PageInfo<BasketballGameQuarterScoreVO> getBasketballGameQuarterScorePageInfo(BasketballGameQuarterScoreVO basketballGameQuarterScore, Pagination pagination) {
		Page<BasketballGameQuarterScoreVO> page = PageHelper.startPage(pagination.getPage(), pagination.getRows());
		basketballGameQuarterScoreMapper.getPageInfo(basketballGameQuarterScore);
		PageInfo<BasketballGameQuarterScoreVO> pageInfo = new PageInfo<BasketballGameQuarterScoreVO>(page);
		return pageInfo;
	}
	
	public BasketballGameQuarterScoreVO getBasketballGameQuarterScoreById(Long basketballGameQuarterScoreId) {
		return basketballGameQuarterScoreMapper.getBasketballGameQuarterScoreById(basketballGameQuarterScoreId);
	}

	@Transactional
	public BasketballGameQuarterScoreVO addBasketballGameQuarterScore(BasketballGameQuarterScoreVO basketballGameQuarterScore) {
		basketballGameQuarterScoreMapper.insert(basketballGameQuarterScore);
		return basketballGameQuarterScore;
	}

    @Transactional
	public BasketballGameQuarterScoreVO updateBasketballGameQuarterScore(BasketballGameQuarterScoreVO basketballGameQuarterScore) {
		basketballGameQuarterScoreMapper.updateByPrimaryKeySelective(basketballGameQuarterScore);
		return basketballGameQuarterScore;
	}

	@Transactional
	public void deleteBasketballGameQuarterScoreById(Long basketballGameQuarterScoreId) {
		basketballGameQuarterScoreMapper.deleteByPrimaryKey(basketballGameQuarterScoreId);
	}

}